#NumPy股票数据如下：
import numpy as np
## Data (rows: stocks / cols: stock prices)
X = np.array([[25,27,29,30],
              [1,5,3,2],
              [12,11,8,3],
              [1,1,2,2],
              [2,6,2,2]])
#要找出方差最小的股票，要求输出该股票的行，应如何操作？
def calc():
    idx = min([(i, np.var(X[i, :])) for i in range(len(X))], key = lambda x: x[1])[0]
    return X[idx]

def test_calc():
    assert list(calc()) == [1, 1, 2, 2]
